<script lang="ts" setup>
import { onLaunch, onError } from '@dcloudio/uni-app'

import { log } from './libs/message'
import { report, reportBase } from './libs/request'
import { appInit } from './libs/init'

onLaunch((e) => {
  log(['App Launch', e]);

  const { scene = -1, query = {} } = e || {}

  const data: any = { scene_id: scene }

  for (const key in query) {
    if (key === 'channel_id') reportBase.channel_id = query[key]
    else data['query_' + key] = query[key]
  }

  report('app_launch', data)

  appInit(query)
})

onError((err) => report('app_error', { err_message: err || 'unknown' }))
</script>

<style lang="less">
/* #ifdef WEB || APP */
html {
  font-family: ChillRoundM;
  text-size-adjust: 100% !important;
}

* {
  // user-select: none;

  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;

  background-size: 100% 100%;
}

/* #endif */

/* #ifdef MP */
page {
  // user-select: none;

  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;

  font-family: ChillRoundM;

  view {
    background-size: 100% 100%;
  }
}

/* #endif */

::-webkit-scrollbar {
  display: none;
}
</style>
